<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <meta name="renderer" content="webkit" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <title>千锋教育大前端Vue教学</title>
  <!-- 引入vue -->
  <script src="https://cdn.staticfile.org/vue/2.6.10/vue.min.js"></script>
</head>

<body style="margin:100px;font-size:22px;">
  <div>真假美猴王</div>
  <div id="app">
    <div v-visible="false">我是六耳猕猴</div>
    <div v-visible="true">我是孙悟空</div>
  </div>
  <script>
    new Vue({
      el: '#app', // 挂载到 id 为 app的DOM上
      directives: {
        visible: {
          inserted: function (el, binding, vnode) {
            el.style.visibility = !binding.value ? 'hidden' : 'visible';
          }
        }
      }
    });
  </script>
</body>

</html>